package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * 新增菜品的口味添加
     * @param dishFlavor
     */
    @Insert("insert into dish_flavor values (null,#{dishId},#{name},#{value})")
    void save(DishFlavor dishFlavor);

    /**
     * 回显菜品(根据菜品id(dishId)查询口味表 )
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> findByDishId(Long dishId);

    /**
     * 根据菜品id(dish_id)删除旧口味
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);
}
